package com.ptszyxx.popose.module.main.message;

import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import androidx.annotation.Nullable;

import com.ptszyxx.popose.BR;
import com.ptszyxx.popose.R;
import com.ptszyxx.popose.common.constants.BundleConstant;
import com.ptszyxx.popose.common.enums.MessageNoticeEnum;
import com.ptszyxx.popose.databinding.FragmentMessageNoticeDetailsBinding;
import com.ysg.base.BaseFragment;
import com.ysg.base.BaseViewModel;
import com.ysg.utils.YStringUtil;

public class MessageNoticeDetailsFragment extends BaseFragment<FragmentMessageNoticeDetailsBinding, BaseViewModel> {
    private String content;
    private MessageNoticeEnum noticeEnum;

    @Override
    public int initContentView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return R.layout.fragment_message_notice_details;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    @Override
    public void initParam() {
        super.initParam();
        Bundle bundle = getArguments();
        if (bundle != null){
            content = bundle.getString(BundleConstant.CONTENT);
            noticeEnum = MessageNoticeEnum.get(bundle.getString(BundleConstant.TAB));
        }
    }

    @Override
    public void initView() {
        super.initView();
        if (null != noticeEnum){
            binding.titleBar.setTitle(noticeEnum.getName());
        }
        if (YStringUtil.isNotEmpty(content)){
            binding.tvContent.setText(Html.fromHtml(content));
        }
    }
}
